// JobAlumnuInfo.js
import React, { Fragment } from 'react'
import PropTypes from 'prop-types'
import { View, Text, Image, StyleSheet, Animated } from 'react-native'
import LinearGradient from 'react-native-linear-gradient'
import { ScaleS, ScaleT, IS_IPHONEX } from 'src/utils/ScreenUtil'
import CustomImage from '../../../../components/image/CustomImage'
import CustomButton from 'src/components/button/CustomButton'
import CustomBoxShadow from '../../../../components/boxshadow/CustomBoxShadow'
import { WIDTH, HEIGHT } from '../../../../utils/ScreenUtil'
import DefaultImage from '../../../../components/image/DefaultImage'
import { defaultPortraitGray, getUserAvatorLocalB } from '../../../../utils/ConfigUtil'

export default class JobBottom extends React.PureComponent {
  static propTypes = {
    data: PropTypes.object,
    chatClick: PropTypes.func,
    logoAnimatedValue: PropTypes.object,
    logoShow: PropTypes.bool,
    isSendResume: PropTypes.bool,
    isLivePost: PropTypes.bool
  }

  render() {
    const { data, chatClick, logoShow, isLivePost, isSendResume } = this.props
    return (
      <View style={[styles.boxShadowView, !logoShow && { height: ScaleS(60) }]}>
        {
          logoShow && <Animated.View style={[styles.customImageView]}>
            <Animated.Image style={[{
              opacity: this.props.logoAnimatedValue.interpolate({
                inputRange: [0, 1],
                outputRange: [0, 1]
              })
            }]} source={require('src/imgC/post/postDetail.png')} />
          </Animated.View>
        }
        <View style={styles.container}>
          <View style={[styles.info, styles.rowalign]}>
            <Text style={styles.infoText}>快来pick我鸭～</Text>
          </View>
          <View style={styles.bottomView}>
            {isLivePost && <CustomButton params={1} style={[styles.customButton, styles.leftCustomButton]} onPress={chatClick}>
              <Text style={[styles.customButtonText, styles.leftCustomButtonText]}>{'沟通'}</Text>
            </CustomButton>}
            {<CustomButton params={isLivePost ? 2 : 1} style={styles.customButton} onPress={chatClick}>
              <Text style={styles.customButtonText}>{(isSendResume && isLivePost) ? '已投递' : isLivePost ? '投递简历' : '沟通'}</Text>
            </CustomButton>}
          </View>
        </View>
      </View>
    )
  }
}

const styles = StyleSheet.create({
  boxShadowView: {
    width: WIDTH,
    shadowOffset: { width: 0, height: ScaleS(6) },
    shadowRadius: ScaleS(29),
    backgroundColor: 'rgba(249, 249, 249, 1)',
    shadowColor: '#B1B2B7'
  },
  container: {
    width: WIDTH,
    height: ScaleS(60),
    shadowColor: '#B1B2B7',
    flexDirection: 'row',
    alignItems: 'center',
    justifyContent: 'space-between',
    marginBottom: IS_IPHONEX ? ScaleS(20) : ScaleS(0)
  },
  rowalign: {
    flexDirection: 'row',
    alignItems: 'center'
  },
  flex1: {
    flex: 1
  },
  avator: {
    width: ScaleS(40),
    height: ScaleS(40),
    resizeMode: 'cover',
    borderRadius: ScaleS(20),
    marginLeft: ScaleS(20),
    marginRight: ScaleS(7)
  },

  name: {
    fontSize: ScaleT(13),
    fontWeight: '400',
    color: '#000000',
    height: ScaleS(18),
    lineHeight: ScaleS(18)
  },
  position: {
    fontSize: ScaleT(10),
    fontWeight: '400',
    color: '#000000',
    height: ScaleS(15),
    lineHeight: ScaleS(15)
  },
  btn: {
    justifyContent: 'center'
  },
  chatImg: {
    width: ScaleS(22),
    resizeMode: 'cover',
    marginRight: ScaleS(8)
  },
  chatTxt: {
    fontSize: ScaleT(20),
    fontWeight: '500'
  },
  leftCustomButton: {
    marginRight: ScaleS(8),
    backgroundColor: 'rgba(60, 60, 60, 1)'
  },
  customButton: {
    paddingHorizontal: ScaleS(21),
    height: ScaleS(30),
    justifyContent: 'center',
    alignItems: 'center',
    marginRight: ScaleS(20),
    backgroundColor: 'rgba(255, 228, 0, 1)',
    borderRadius: ScaleS(4)
  },
  customImageView: {
    width: WIDTH,
    height: ScaleS(70),
    backgroundColor: 'white',
    alignItems: 'flex-end',
    justifyContent: 'flex-end'
  },

  infoText: {
    marginLeft: ScaleS(20),
    fontSize: ScaleS(13),
    color: 'rgba(60, 60, 60, 1)',
    fontWeight: '400'
  },
  customButtonText: {
    fontSize: ScaleS(12),
    color: 'rgba(60, 60, 60, 1)'
  },
  leftCustomButtonText: {
    color: 'rgba(255, 228, 0, 1)'
  },
  bottomView: {
    flexDirection: 'row'
  }
})
